<script>
export default {
  name: "PersonalIndexView",
  data() {
    return {
      dialogImageUrl: '',
      dialogVisible: false
    };
  },
  methods: {
    handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    }
  }
}
</script>

<template>
<div>
  <h1 style="color: orange">个人中心页面</h1>
  <el-form label-width="80px" style="width: 500px">
    <el-form-item label="头像">
      <!-- 头像上传开始 -->
      <el-upload
          action="https://jsonplaceholder.typicode.com/posts/"
          list-type="picture-card"
          :on-preview="handlePictureCardPreview"
          :on-remove="handleRemove">
        <i class="el-icon-plus"></i>
      </el-upload>
      <el-dialog :visible.sync="dialogVisible">
        <img width="100%" :src="dialogImageUrl" alt="">
      </el-dialog>
      <!-- 头像上传结束 -->

    </el-form-item>
    <el-form-item label="昵称">
      <el-input placeholder="请输入昵称"></el-input>
    </el-form-item>
    <el-form-item label="用户名">
      <el-input value="tom" disabled></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary">保存</el-button>
    </el-form-item>
  </el-form>
</div>
</template>

<style scoped>

</style>